// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch.Inference;

[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.Inference.Json.Ai21ServiceSettingsConverter))]
public sealed partial class Ai21ServiceSettings
{
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public Ai21ServiceSettings(string modelId)
	{
		ModelId = modelId;
	}
#if NET7_0_OR_GREATER
	public Ai21ServiceSettings()
	{
	}
#endif
#if !NET7_0_OR_GREATER
	[System.Obsolete("The type contains required properties that must be initialized. Please use an alternative constructor to ensure all required values are properly set.")]
	public Ai21ServiceSettings()
	{
	}
#endif
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	internal Ai21ServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel)
	{
		_ = sentinel;
	}

	/// <summary>
	/// <para>
	/// A valid API key for accessing AI21 API.
	/// </para>
	/// <para>
	/// IMPORTANT: You need to provide the API key only once, during the inference model creation.
	/// The get inference endpoint API does not retrieve your API key.
	/// After creating the inference model, you cannot change the associated API key.
	/// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key.
	/// </para>
	/// </summary>
	public string? ApiKey { get; set; }

	/// <summary>
	/// <para>
	/// The name of the model to use for the inference task.
	/// Refer to the AI21 models documentation for the list of supported models and versions.
	/// Service has been tested and confirmed to be working for <c>completion</c> and <c>chat_completion</c> tasks with the following models:
	/// </para>
	/// <list type="bullet">
	/// <item>
	/// <para>
	/// <c>jamba-mini</c>
	/// </para>
	/// </item>
	/// <item>
	/// <para>
	/// <c>jamba-large</c>
	/// </para>
	/// </item>
	/// </list>
	/// </summary>
	public
#if NET7_0_OR_GREATER
	required
#endif
	string ModelId { get; set; }

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from the AI21 API.
	/// By default, the <c>ai21</c> service sets the number of requests allowed per minute to 200. Please refer to AI21 documentation for more details.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? RateLimit { get; set; }
}

public readonly partial struct Ai21ServiceSettingsDescriptor
{
	internal Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettings Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public Ai21ServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettings instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public Ai21ServiceSettingsDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor(Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettings instance) => new Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettings(Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor descriptor) => descriptor.Instance;

	/// <summary>
	/// <para>
	/// A valid API key for accessing AI21 API.
	/// </para>
	/// <para>
	/// IMPORTANT: You need to provide the API key only once, during the inference model creation.
	/// The get inference endpoint API does not retrieve your API key.
	/// After creating the inference model, you cannot change the associated API key.
	/// If you want to use a different API key, delete the inference model and recreate it with the same name and the updated API key.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor ApiKey(string? value)
	{
		Instance.ApiKey = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// The name of the model to use for the inference task.
	/// Refer to the AI21 models documentation for the list of supported models and versions.
	/// Service has been tested and confirmed to be working for <c>completion</c> and <c>chat_completion</c> tasks with the following models:
	/// </para>
	/// <list type="bullet">
	/// <item>
	/// <para>
	/// <c>jamba-mini</c>
	/// </para>
	/// </item>
	/// <item>
	/// <para>
	/// <c>jamba-large</c>
	/// </para>
	/// </item>
	/// </list>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor ModelId(string value)
	{
		Instance.ModelId = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from the AI21 API.
	/// By default, the <c>ai21</c> service sets the number of requests allowed per minute to 200. Please refer to AI21 documentation for more details.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor RateLimit(Elastic.Clients.Elasticsearch.Inference.RateLimitSetting? value)
	{
		Instance.RateLimit = value;
		return this;
	}

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from the AI21 API.
	/// By default, the <c>ai21</c> service sets the number of requests allowed per minute to 200. Please refer to AI21 documentation for more details.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor RateLimit()
	{
		Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(null);
		return this;
	}

	/// <summary>
	/// <para>
	/// This setting helps to minimize the number of rate limit errors returned from the AI21 API.
	/// By default, the <c>ai21</c> service sets the number of requests allowed per minute to 200. Please refer to AI21 documentation for more details.
	/// </para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor RateLimit(System.Action<Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor>? action)
	{
		Instance.RateLimit = Elastic.Clients.Elasticsearch.Inference.RateLimitSettingDescriptor.Build(action);
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettings Build(System.Action<Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor> action)
	{
		var builder = new Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettingsDescriptor(new Elastic.Clients.Elasticsearch.Inference.Ai21ServiceSettings(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}